/*
* @Author: Choisaaaa
* @Date: 2018/5/3  16:02
* 商品模块的子级路由控制
*/

import React from "react";
import { BrowserRouter as Router, Switch, Redirect, Route, Link } from 'react-router-dom'
//页面
import ProductList from 'page/product/product/product-list.jsx';
import ProductSave from 'page/product/product/product-save.jsx';
import ProductDetail from 'page/product/product/product-detail.jsx';
import CategoryList from 'page/product/product-category/product-category-list.jsx';
import CategoryAdd from 'page/product/product-category/product-category-add.jsx';

class ProductRouter extends React.Component{
    render(){
        return(
            <Switch>
                <Route path="/product/index" component={ProductList}/>
                <Route path="/product/save/:pid?" component={ProductSave}/>                //?表示可选
                <Route path="/product/detail/:pid" component={ProductDetail}/>
                <Route path="/product-category/index/:categoryId?" component={CategoryList}/>
                <Route path="/product-category/add" component={CategoryAdd}/>
                <Redirect exact from="/product" to="/product/index"/>
                <Redirect exact from="/product-category" to="/product-category/index"/>
            </Switch>
        );
    }
}
export default ProductRouter;